package com.boarsoft.webapp.util;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

public class ServletUtil {
	/**
	 * 
	 * @param request
	 * @param key
	 * @return
	 */
	public static String getCookie(HttpServletRequest request, String key) {
		Cookie[] ca = request.getCookies();
		if (ca == null || ca.length < 1)
			return null;
		for (Cookie c : ca) {
			if (c.getName().equals(key)) {
				return c.getValue();
			}
		}
		return null;
	}
}
